package com.aaa.system.controller.api;



import com.aaa.entity.SysDictType;
import com.aaa.security.annotation.HasPermission;
import com.aaa.security.annotation.MyLog;
import com.aaa.system.service.SysDictTypeService;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * #Description 字典类型操作
 * @author 荆豪峰
 * @version 1.0
 * #Date: 2023/2/27 15:25
 */
@Api(value = "system/sdt", tags = {"#Description 字典类型操作 #Date: 2023/2/27 15:25"})
@RestController
@RequestMapping("system/sdt")
public class ApiSysDictTypeController {
    @Autowired
    private SysDictTypeService sysDictTypeService;
    /**
     * #Description 字典类型查询
     * @param currentPage
 * @param pageSize
 * @param sysDictType
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/2/28
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "currentPage", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "pageSize", value = "", required = true),
            @ApiImplicitParam(paramType = "body", dataType = "SysDictType", name = "sysDictType", value = "", required = true)
    })
    @ApiOperation(value = "#Description 字典类型查询 #Date 2023/2/28", notes = "#Description 字典类型查询 #Date 2023/2/28", httpMethod = "POST")
    @MyLog(title="查询字典类型")
    @HasPermission(value = "dictType:search")
    @PostMapping("list")
    public Result list(Integer currentPage, Integer pageSize,@RequestBody SysDictType sysDictType){
       return sysDictTypeService.list(currentPage,pageSize,sysDictType);
    }
    /**
     * #Description 字典类型删除
     * @param dictId
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/2/27
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "dictId", value = "", required = true)
    })
    @ApiOperation(value = "#Description 字典类型删除 #Date 2023/2/27", notes = "#Description 字典类型删除 #Date 2023/2/27", httpMethod = "DELETE")
    @MyLog(title="删除字典类型")
    @HasPermission(value = "dictType:delete")
    @DeleteMapping("delete")
    public Result delete(Integer dictId){
        return sysDictTypeService.delete(dictId);
    }
    /**
     * #Description 字典类型添加
     * @param sysDictType
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/2/27
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "SysDictType", name = "sysDictType", value = "", required = true)
    })
    @ApiOperation(value = "#Description 字典类型添加 #Date 2023/2/27", notes = "#Description 字典类型添加 #Date 2023/2/27", httpMethod = "POST")
    @MyLog(title="添加字典类型")
    @HasPermission(value = "dictType:insert")
    @PostMapping("insert")
    public Result insert(@RequestBody SysDictType sysDictType){
        return sysDictTypeService.insert(sysDictType);
    }
    /**
     * #Description 字典类型修改
     * @param sysDictType
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/2/27
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "SysDictType", name = "sysDictType", value = "", required = true)
    })
    @ApiOperation(value = "#Description 字典类型修改 #Date 2023/2/27", notes = "#Description 字典类型修改 #Date 2023/2/27", httpMethod = "POST")
    @MyLog(title="更新字典类型")
    @HasPermission(value = "dictType:update")
    @PostMapping("update")
    public Result update(@RequestBody SysDictType sysDictType) {
        return sysDictTypeService.update(sysDictType);
    }
    /**
     * #Description 字典类型批量删除
     * @param dictId
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/2/28
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String[]", name = "dictId", value = "", required = true)
    })
    @ApiOperation(value = "#Description 字典类型批量删除 #Date 2023/2/28", notes = "#Description 字典类型批量删除 #Date 2023/2/28", httpMethod = "POST")
    @MyLog(title="批量删除字典类型")
    @HasPermission(value = "dictType:delete")
    @PostMapping("/deletes")
    public Result deletes(String[] dictId){

        return sysDictTypeService.deletes(dictId);
    }
}
